

function getLanguages()
{
	

	var myAjax = new Ajax.Request(
    'http://localhost:8080/service/Common.groovy?method=GetLanguageList',
    {

      method: 'get',
      parameters: {},
      onSuccess: function (xhr)
        {

          // Objet Document contenu dans la propriété responseXML
          var nodeLanguage = xhr.responseXML;

          var nodesLanguage = nodeLanguage.firstChild.getElementsByTagName('language');

          var output = 'new google.translate.TranslateElement({' + " pageLanguage: 'en', includedLanguages: '";
          var first = true
          for (i=0 ; i<nodesLanguage.length ; i++)
          {
            var nodeLanguage = nodesLanguage[i];
 		 
            var nodeCode = nodeLanguage.getElementsByTagName('code')[0];
            var code = nodeCode.firstChild.nodeValue;


  			if(!first)
  			{
  				output += ',';
  			}
  			
  			
            output += code;
            first=false;
                      }
                      
                      output += "' },'google_translate_element');";
	    	eval(output);

        } // onSuccess
    }
  );

	
}
$j(document).ready(function(){
	/*alert(" swda");*/
	getLanguages();
});